package io.github.eiot.json;

import com.fasterxml.jackson.databind.module.SimpleModule;
import io.github.eiot.codec.*;
import io.github.eiot.json.deserializer.*;
import io.github.eiot.json.serializer.*;
import io.netty.buffer.ByteBuf;


/**
 * @author yan
 * @since 2025-09-07
 */
public class IotFrameModule extends SimpleModule {

    public IotFrameModule() {
        super();
        this.addSerializer(Ascii.class, new AsciiSerializer());
        this.addSerializer(BCD.class, new BCDSerializer());
        this.addSerializer(BCDTime.class, new BCDTimeSerializer());
        this.addSerializer(CP56time2a.class, new CP56time2aSerializer());
        this.addSerializer(Hex.class, new HexSerializer());
        this.addSerializer(NumberUnit.class, new NumberUtilSerializer());
        this.addSerializer(ByteBuf.class, new ByteBufSerializer());
        this.addSerializer(ByteBufRef.class, new ByteBufRefSerializer());

        this.addDeserializer(Ascii.class, AsciiDeserializer.INSTANCE);
        this.addDeserializer(BCD.class, BCDDeserializer.INSTANCE);
        this.addDeserializer(BCDNumber.class, BCDNumberDeserializer.INSTANCE);
        this.addDeserializer(BCDTime.class, BCDTimeDeserializer.INSTANCE);
        this.addDeserializer(CP56time2a.class, CP56time2aDeserializer.INSTANCE);
        this.addDeserializer(Hex.class, HexDeserializer.INSTANCE);
        this.addDeserializer(NumberUnit.class, NumberUnitDeserializer.INSTANCE);
        this.addDeserializer(OffsetBCDNumber.class, OffsetBCDNumberDeserializer.INSTANCE);
        this.addDeserializer(OffsetNumberUnit.class, OffsetNumberUnitDeserializer.INSTANCE);
        this.addDeserializer(ByteBuf.class, new ByteBufDeserializer());
        this.addDeserializer(ByteBufRef.class, new ByteBufRefDeserializer());
    }

}
